﻿using UnityEngine;
using UnityEngine.UI;
public class TextAss : MonoBehaviour
{
    public string s;
    public char[] c;
    public string show;
    public int index=0;
    private void Awake()
    {
        s = GetComponent<Text>().text;
        c = s.ToCharArray();
    }
    private void Start()
    {
        InvokeRepeating("Next", 0.2f, 0.2f);
    }
    private void Update()
    {
        GetComponent<Text>().text = show;
    }
    void Next()
    {
        if (index < c.Length)
        {
            show += c[index];
            index++;
        }
        else
        {
            CancelInvoke();
        }
    }
}
